package com.leetcode.August;

/**
 * @Description: 27. 移除元素
 * @Author: Mr.Fxy
 * @CreateTime: 2024-08-14 22:40
 */
public class LC27移除元素 {
    public int removeElement(int[] nums, int val) {
        int fast = 0;
        int slow;
        for (slow = 0; fast < nums.length; fast++) {
            if (nums[fast] != val){
                nums[slow] = nums[fast];
                slow++;
            }
        }
        return slow;
    }
}
